<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								考号：<input type="text" name="uid"/><input type="hidden" name="ksid" th:value="${paperdef.id}">
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-warning" onclick="$.table.exportExcel()" ><!-- shiro:hasPermission="exam:scores:export" -->
						<i class="fa fa-file-excel-o"></i> 导出成绩单
				 </a>
				<a class="btn btn-warning" onclick="exportPdf()" ><!-- shiro:hasPermission="exam:scores:export" -->
					<i class="fa fa-file-pdf-o"></i> 导出试卷
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "exam/scores";

        $(function() {
            var options = {
                url: prefix + "/list",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "成绩单",
				search: false,
		        showExport: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '编号'
				},
				{
					field : 'uid', 
					title : '考号',
					sortable: true
				},
				{
					field : 'score', 
					title : '成绩',
					sortable: true
				},
				{
					field : 'score1', 
					title : '得分一',
					sortable: true
				},
				{
					field : 'score2', 
					title : '得分二',
					sortable: true
				},
				{
					field : 'score3', 
					title : '得分三',
					sortable: true
				},
				 {
					field : 'score4', 
					title : '得分四',
					sortable: true
				},
				/*{
					field : 'score5', 
					title : '得分五',
					sortable: true
				},
				{
					field : 'score6', 
					title : '得分六',
					sortable: true
				}, */

				{
					field : 'jjtime', 
					title : '评判时间',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="#" onclick="lookpaper(\'' + row.id + '\')"><i class="fa fa-eye"></i> 查看试卷</a>');
						actions.push('<a class="btn btn-success btn-xs " href="#" onclick="createpaper(\'' + row.id + '\')"><i class="fa fa-eye"></i> 生成试卷</a>');
						actions.push('<a class="btn btn-success btn-xs " href="#" onclick="createblankpaper(\'' + row.id + '\')"><i class="fa fa-eye"></i> 生成样卷</a>');
                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        function lookpaper(id){
        	$.modal.openTab("试卷详情",prefix + "/detail/"+id);
        }
		function createpaper(id){
			$.operate.post(prefix + "/pdfpaper/"+id);
		}
		function createblankpaper(id){
			$.operate.post(prefix + "/pdfblankpaper/"+id);
		}
		function exportPdf(){
			$.operate.post(prefix + "/exportpaper/"+[[${paperdef.id}]]);
		}
	</script>
</body>
</html>